﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Data.EntityFramework.SqlServer
{
    /// <summary>
    /// 
    /// </summary>
    public class SqlServerDbContext : DbContextBase
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="connectionName"></param>
        /// <param name="options"></param>
        public SqlServerDbContext(string connectionName, DbContextOptions options) : this(connectionName, 30, options)
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="connectionName"></param>
        /// <param name="commandTimeout"></param>
        /// <param name="options"></param>
        public SqlServerDbContext(string connectionName, int commandTimeout, DbContextOptions options) : base(connectionName, commandTimeout, options)
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="optionsBuilder"></param>
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(ConnectionString, (builder) =>
            {
                builder.CommandTimeout(this.CommandTimeout);
            });
        }
    }
}
